<%@page import="com.situ.company.entity.User"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!-- 引入jstl -->
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<%-- 
	<%
		List<User> list = (ArrayList<User>)request.getAttribute("list");
	%>
	<%=list%><br/> 
	--%>
	${list}
	<table border="1" cellspacing="0" width="400px">
		<tr>
			<td>ID</td>
			<td>名字</td>
			<td>密码</td>
			<td>年龄</td>
			<td>邮箱</td>
			<td>删除</td>
		</tr>
		<c:forEach items="${list}" var="user">
			<tr>
				<td>${user.id}</td>
				<td>${user.name}</td>
				<td>${user.password }</td>
				<td>${user.age}</td>
				<td>${user.email }</td>
				<td><a href="javascript:void(0)" onclick="deleteById(${user.id})">删除</a></td>
			</tr>
		</c:forEach>
		
	</table>
	
	<script type="text/javascript">
		function deleteById(id) {
			var isDelete = confirm();
			if(isDelete) {
				location.href = '${pageContext.request.contextPath}/user?method=deleteById&id=' + id;
			}
		}

	</script>
	
</body>
</html>